Data Wrangling
# Read in the CA DFW Oil Spill Incident Tracking data
ca_oil <- read_sf(here("ds394"), layer = "ds394") %>%
clean_names()
# Check the projection:
st_crs(ca_oil) # EPSG = 3310
# Read in the CA county data (TIGER shapefile):
ca_counties <- read_sf(here("ca_counties"), layer = "CA_Counties_TIGER2016") %>%
clean_names() %>%
select(name)
# Check the projection
st_crs(ca_counties) # EPSG = 3857
# Transform ca_counties into ca_oil
ca_counties <- st_transform(ca_counties, st_crs(ca_oil))
Interactive map
tmap_mode("view")
tm_basemap("Esri.WorldStreetMap") +
tm_shape(ca_counties) +
tm_fill(col = "forestgreen", alpha = 0.75) +
tm_borders(col = "black") +
tm_shape(ca_oil) +
tm_dots(col = "gold",
alpha = 0.75)